import {TableBookList} from "../../common/class/TableBookList";
import moment from "moment";

export function getNextUpdateTime(bookInfo: TableBookList.Data) {
    const updateTime = bookInfo.last_update_time;
    const frequency = bookInfo.update_frequency;
    if (updateTime && frequency) {
        switch (frequency) {
            case "day":
                return moment(updateTime).add(1, "day").valueOf();
            case "month":
                return moment(updateTime).add(1, "month").valueOf();
            case "week":
                return moment(updateTime).add(7, "day").valueOf();
        }
    }
    return 0;
}
